from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class menu_gui_fake :
    def __init__ ( self ) :
        self . _hide_menu = False
        self . _application_window_reply = None
        self . _gui_create_frame_reply = None
    def show_menu ( self ) :
        mediator_menu_gui_tests . _call_history += [ menu_gui_fake . show_menu ]
    def hide_menu ( self ) :
        self . _hide_menu = True
    def application_window_reply ( self , window ) :
        self . _application_window_reply = window
    def gui_create_frame_reply ( self , frame ) :
        self . _gui_create_frame_reply = frame

class arbitrary_module_fake :
    def show_menu ( self ) :
        mediator_menu_gui_tests . _call_history += [ arbitrary_module_fake . show_menu ]
    def hide_menu ( self ) :
        pass
    def application_window_reply ( self , window ) :
        pass
    def gui_create_frame_reply ( self , frame ) :
        pass

class mediator_menu_gui_tests : 
    'mediator_menu_gui'
    def __init__ ( self , test ) :
        mediator_menu_gui_tests . _call_history = [ ]
        self . _test = test
        self . _menu_gui = menu_gui_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'menu_gui' 
            , self . _menu_gui
            , arbitrary_module_fake
            ) )
    def test_show_menu ( self ) :
        self . _mediator . show_menu ( )
        self . _test . assume_equal ( mediator_menu_gui_tests . _call_history [ : 1 ] , [ menu_gui_fake . show_menu ] )
    def test_hide_menu ( self ) :
        self . _mediator . hide_menu ( )
        self . _test . assume_true ( self . _menu_gui . _hide_menu )
    def test_application_window_reply ( self ) :
        self . _mediator . application_window_reply ( 'my window' )
        self . _test . assume_equal ( self . _menu_gui . _application_window_reply , 'my window' )
    def test_gui_create_frame_reply ( self ) :
        self . _mediator . gui_create_frame_reply ( 'my frame' )
        self . _test . assume_equal ( self . _menu_gui . _gui_create_frame_reply , 'my frame' )
